package com.dz.goods.controller;

import com.dz.common.base.BaseApiService;
import com.dz.common.base.BasePageResultsVO;
import com.dz.common.base.ResponseBase;
import com.dz.goods.domain.entity.Album;
import com.dz.goods.domain.entity.Brand;
import com.dz.goods.domain.vo.AlbumParamsVO;
import com.dz.goods.domain.vo.AlbumResultsVO;
import com.dz.goods.domain.vo.BrandParamsVO;
import com.dz.goods.domain.vo.BrandResultsVO;
import com.dz.goods.service.AlbumService;
import com.dz.goods.service.BrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/goods/album")
@Api(tags = "相册管理")
public class AlbumController extends BaseApiService {

    @Autowired
    private AlbumService albumService;

    @GetMapping("/get_album_list")
    @ApiOperation(value = "条件查询品牌")
    public ResponseBase getAlbumList(AlbumParamsVO vo) throws Exception {
        BasePageResultsVO<AlbumResultsVO> albumList = albumService.getAlbumList(vo);
        return setResultSuccess(albumList) ;
    }
    @PostMapping("/add")
    @ApiOperation(value = "添加相册")
    public ResponseBase add(@RequestBody Album album) throws Exception {
        Album add = albumService.add(album);
        return setResultSuccess(add) ;
    }
    @PostMapping("/edit")
    @ApiOperation(value = "更新相册")
    public ResponseBase edit(@RequestBody Album album) throws Exception {
        Album edit = albumService.edit(album);
        return setResultSuccess(edit) ;
    }
    @GetMapping("/get_by_id")
    @ApiOperation(value = "根据id查询相册")
    public ResponseBase getById(Long albumId) throws Exception {
        Album album = albumService.findById(albumId);
        return setResultSuccess(album) ;
    }

    @DeleteMapping("/delete")
    @ApiOperation(value = "删除相册")
    public ResponseBase delete(Long albumId) throws Exception {
        albumService.delete(albumId);
        return setResultSuccess();
    }

}